package com.cedric.yixianpai.game.cards.Sects.swordCards.d_YuanYing;

import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class LiuYunLuanJian extends SwordCard {
    private int damageCount=0;//攻击段数
    /**
     * title:流云乱剑
     * effect:SE-1 2X4/5/6攻
     */
    public LiuYunLuanJian(@Value("1") int lvl) {
        super("流云乱剑");
        this.setLevel(lvl);
        this.setPeriod(Period.YUANYING);
        this.setDescription("灵气-1 2X4/5/6攻");
        this.setSpiritNeed(1);
        this.setDamage(2);
        if (1 == lvl) {
            this.damageCount=4;
        } else if (2 == lvl) {
            this.damageCount=5;
        } else if (3 == lvl) {
            this.damageCount=6;
        } else {
            throw new RuntimeException("Card Level Error!");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        if(Sta1.spiritEnough(this.getSpiritNeed())){
            for (int i = 0; i < this.damageCount; i++) {
                Sta1.attack(Sta2,this.getDamage());
            }
            Sta1.getPlayerBuff().clearSwordIntent();
            return true;
        }
        return false;
    }
}
